<template>
  <view v-if="visible" class="modal-overlay" @click="closeModal">
    <view class="modal-content" @click.stop>
      <image :src="imageSrc" class="modal-image" />
    </view>
  </view>
</template>

<script setup lang="ts">
defineProps<{
  visible: boolean;
  imageSrc: string;
}>();

const emit = defineEmits<{
  (e: 'update:visible', value: boolean): void;
}>();

const closeModal = () => {
  emit('update:visible', false);
};
</script>

<style scoped>
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 20rpx;
  border-radius: 16rpx;
  box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.2);
}

.modal-image {
  width: 100%;
  height: 80vh;
  object-fit: contain;
}
</style>
